package com.ecric.http.webView;

import android.graphics.Bitmap;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * <h3>Description</h3>
 * TODO
 * <h3>Author</h3> Eric
 * <h3>Date</h3> 2017/9/21 14:20
 * <h3>Copyright</h3> Copyright (c)2017 Shenzhen TLKY  Co., Ltd. Inc. All rights reserved.
 */
public class MyWebViewClient extends WebViewClient {

    /**
     * 新开页面时用自己定义的webview来显示，不用系统自带的浏览器来显示
     * @param view
     * @param url
     * @return
     */
    public boolean shouldOverviewUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
    }
    /**
     * // 开始加载网页时要做的工作
     * @param view
     * @param url
     * @param favicon
     */
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);
    }
    /**
     * 加载完成时要做的工作
     * @param view
     * @param url
     */
    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
    }
    /**
     * 加载错误时要做的工作
     * @param view
     * @param request
     * @param error
     */
    @Override
    public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
        super.onReceivedError(view, request, error);
    }
}

